package com.bys.generator.base;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.bys.generator.util.DateUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

@Data
public class BaseModel {
    /** Assign_id 是雪花算法 */
    @Schema(description = " 主键 id")
    @TableId(value = "id",type = IdType.AUTO)
    private Long id;

    @Schema(description = "创建者")
    @TableField("create_user")
    private Long createUser;

    @Schema(description = " 创建时间")
    @DateTimeFormat(pattern = DateUtil.dateTimePattern)
    @TableField(value = "create_time",fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @Schema(description = " 更新者")
    @TableField("update_user")
    private Long updateUser;
    @Schema(description = "更新时间")
    @DateTimeFormat(pattern = DateUtil.dateTimePattern)
    @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @Schema(description = "删除标志")
    @TableField(value = "is_deleted", fill =FieldFill.INSERT)
    private Boolean isDeleted;
}
